package com.tvserials.notification.services;

import com.tvserials.notification.utils.NetworkUtils;

/**
 * Created by Alex on 01.05.2014.
 */
public class ServiceFactory {
    public static boolean localMode = false;

    public static NotificationService getNotificationService() {
        boolean remoteServiceAvailable = isRemoteServiceAvailable();
        if (remoteServiceAvailable) {
            return new RemoteNotificationService();
        }
        return new LocalNotificationService();
    }

    private static boolean isRemoteServiceAvailable() {
        return NetworkUtils.ping(RemoteNotificationService.BASE_URL, 5000);
    }
}
